#include<iostream>
#include<cstring>
using namespace std;
const int N = 50, M = N * N;
int g[N][N], g1[N][N];
int h[N], e[M], ne[M], idx;
int dx[] = { -1,0,1,0 };
int dy[] = { 0,1,0,-1 };
int n, m;
int n1, n2;
int match[N];
bool st[N];
void add(int a, int b)
{
	e[idx] = b, ne[idx] = h[a], h[a] = idx++;
}
bool dfs(int u)
{
	for (int i = h[u]; ~i; i = ne[i]) {
		int j = e[i];
		if (!st[j]) {
			st[j] = 1;
			if (!match[j] || dfs(match[j])) {
				match[j] = u;
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	cin >> n >> m;
	while (m--) {
		int a, b;
		cin >> a >> b;
		g[a][b] = 1;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (g[i][j])continue;
			if ((i + j) & 1)g1[i][j] = ++n2;
			else g1[i][j] = ++n1;
		}
	}
	/*for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cout << g1[i][j] << " ";
		}
		cout << endl;
	}*/
	memset(h, -1, sizeof(h));
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (g[i][j] || (i + j ) & 1)continue;
			for (int k = 0; k < 4; k++) {
				int x = i + dx[k];
				int y = j + dy[k];
				if (x<1 || x>n || y<1 || y>n || g[x][y])continue;
				//cout << "g1[i][j]==" << g1[i][j] << "    g1[x][y]==" << g1[x][y] << endl;
				add(g1[i][j], g1[x][y]);
			}
		}
	}
	//cout << "idx==" << idx << endl;
	int ans = 0;
	for (int i = 1; i <= n1; i++) {
		memset(st, 0, sizeof(st));
		if (dfs(i)) {
			ans++;
		}
	}
	/*for (int i = 1; i <= n2; i++) {
		cout << "i==" << i << "   match[i]==" << match[i] << endl;
	}*/
	cout << ans * 2 << endl;
	return 0;
}